Category: classic asp
03/28/06 07:39 - ID#22268
Trinary For Classic ASP
Ok there's no Trianry operator in Classic ASP. For those of you who don't know what I'm talking about it's this kind of syntax that you can find in most bracketed languages. The operator uses two charcters and looks like this " ?: ". It's used like this:
//JavaScript
var sDude = new String("Anakin");
var sMessage = new String();
sMessage = (sDude == "Anakin")?"Jedi":"Sith";
alert(sMessage);
//alerts "Jedi"
But On the server VBScript dosen't have anyoperators like that which I find are quite a line saver in other languages. Trianry has been found in other places VBScript has been used like VBA (Visual Basic for Applications), and when it is supported it look like a function/language construct called IIf.
A work around for this that I've found usefull was to define a function for the trinary operation, or inline if, or immeidate if as it's been called. Like so
'VBScript
'RunAt=Server
Function IIf(varTest, varTrue, varFalse)
If varTest Then IIf = varTrue Else IIf = varFalse
End Function
But be wary children, you must declare each parameter or you'll get an error.
I'll try to only post things that I think are hard to find answers and things that I at least have a solid work around for. Otherwise happy coding.
--muja
Permalink: Trinary_For_Classic_ASP.html
Words: 242
Category: classic asp
03/28/06 07:18 - ID#22267
Classic ASP
Still there are a lot of programmers that program in Classic ASP, and don't have an option to change that could use a resource like I hope this journal posting will become.
I'm going to keep updating this journal everytime I find something wonky with Classic ASP that I've figured out.
Maybe I'll start a profile called William Gates where I can post these things. Ooh, or maybe I'll just start a category called Classic ASP (enknot's kinda slow sometimes kids, you're going to have to forgive him.)
First one's first is the Data Dictionary .Add Bug...yeah.
Permalink: Classic_ASP.html
Words: 111
Author Info
Date Cloud
- 11/14
- 07/13
- 11/12
- 06/12
- 05/12
- 10/11
- 09/11
- 08/11
- 07/11
- 06/11
- 05/11
- 04/11
- 03/11
- 02/11
- 11/10
- 10/10
- 08/10
- 07/10
- 06/10
- 05/10
- 04/10
- 02/10
- 01/10
- 12/09
- 11/09
- 07/09
- 06/09
- 03/09
- 01/09
- 12/08
- 11/08
- 09/08
- 08/08
- 07/08
- 06/08
- 04/08
- 02/08
- 01/08
- 12/07
- 09/07
- 08/07
- 07/07
- 05/07
- 04/07
- 02/07
- 01/07
- 12/06
- 11/06
- 10/06
- 09/06
- 08/06
- 07/06
- 06/06
- 05/06
- 04/06
- 03/06
- 02/06
- 01/06
- 12/05
- 08/04